-
Notifications
You must be signed in to change notification settings - Fork 1k
Python: Add an azure function streaming example #3173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…l-time streaming of agent responses using Azure SignalR Service. Include a sample frontend as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a comprehensive sample demonstrating real-time streaming of agent responses using Azure SignalR Service with the Agent Framework. The sample shows how to implement user isolation through SignalR groups, enabling multiple concurrent users to chat with agents without interference.
Changes:
- Added a new Azure Functions sample (09_agent_streaming_signalr) implementing SignalR-based streaming
- Created a custom SignalRServiceClient for REST API communication with Azure SignalR Service
- Implemented SignalRCallback using AgentResponseCallbackProtocol for streaming updates
- Included a web-based frontend with HTML/CSS/JavaScript for real-time chat interface
- Added comprehensive documentation explaining the architecture and user isolation patterns
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| function_app.py | Main Azure Functions application with SignalR client, callback implementation, and HTTP endpoints for negotiation, group management, and thread creation |
| tools.py | Mock travel planning tools (weather forecast and local events) for agent demonstrations |
| requirements.txt | Python dependencies including azure-functions, agent-framework-azurefunctions, azure-identity, and aiohttp |
| host.json | Azure Functions host configuration with Durable Task settings |
| local.settings.json.template | Configuration template for local development with Azure OpenAI and SignalR connection strings |
| content/index.html | Complete web interface with SignalR JavaScript client, real-time message streaming, and conversation management |
| README.md | Comprehensive documentation covering architecture, API endpoints, user isolation patterns, and setup instructions |
Real-Time Streaming Agents with Azure SignalR
Why is this change required?
Traditional agent implementations either:
What problem does it solve?
Streaming Response Problem: Users see responses appear in real-time as the agent generates them, instead of waiting for the entire response to complete.
User Isolation Problem: Multiple concurrent users can chat without seeing each other's conversations. Messages are delivered only to the specific conversation group, not broadcast to all connected clients.
Architecture Problem: Shows how to integrate Azure SignalR Service REST API with the Agent Framework's AgentResponseCallbackProtocol for production-grade real-time communication.
What scenario does it contribute to?
This sample enables several real-world use cases:
Contribution Checklist